package com.atguigu.spzx.user.mapper;

import com.atguigu.spzx.user.entity.UserAddress;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * <p>
 * UserAddressMapper
 * </p>
 *
 * @author flyduck
 * @since 2023/11/6
 */
@Mapper
public interface UserAddressMapper extends BaseMapper<UserAddress> {

    /**
     * 根据userId获取用户地址列表
     * @param userId
     * @return
     */
    default List<UserAddress> getUserAddressListByUserId(Long userId){
        QueryWrapper<UserAddress> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        return this.selectList(queryWrapper);
    }
}
